//
//  ShareItemController.m
//  PosApp
//
//  Created by 刘萍 on 2018/9/19.
//  Copyright © 2018年 李英新. All rights reserved.
//

#import "ShareItemController.h"
#import <TencentOpenAPI/TencentOAuth.h>
#import <TencentOpenAPI/QQApiInterface.h>
#import <TencentOpenAPI/QQApiInterfaceObject.h>

@interface ShareItemController ()
@property (weak, nonatomic) IBOutlet UIView *ShareBackView;

@end

@implementation ShareItemController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.ShareBackView.layer.cornerRadius = 8;
    self.ShareBackView.layer.masksToBounds = YES;
}
- (IBAction)ClickOnBtnOfShareItemController01:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)ClickOnBtnOfShareItemController02:(id)sender {
    //微信分享
    SendMessageToWXReq *sendReq = [[SendMessageToWXReq alloc] init];
    sendReq.bText = NO;//不使用文本信息
    sendReq.scene = 1;//0 = 好友列表 1 = 朋友圈 2 = 收藏
    
    //创建分享内容对象
    WXMediaMessage *urlMessage = [WXMediaMessage message];
    urlMessage.title = @"分享标题";//分享标题
    urlMessage.description = @"分享描述";//分享描述
    [urlMessage setThumbImage:[UIImage imageNamed:@"LoginImage01"]];//分享图片,使用SDK的setThumbImage方法可压缩图片大小
    
    //创建多媒体对象
    WXWebpageObject *webObj = [WXWebpageObject object];
    webObj.webpageUrl = @"";//分享链接
    
    //完成发送对象实例
    urlMessage.mediaObject = webObj;
    sendReq.message = urlMessage;
    
    //发送分享信息
    [WXApi sendReq:sendReq];
}
- (IBAction)ClickOnBtnOfShareItemController03:(id)sender {
    
    NSString *utf8String = @"https://www.baidu.com";
    NSString *title = @"分享标题";
    NSString *description = @"分享描述";
    NSString *previewImageUrl = @"kahis";
    QQApiNewsObject * newsObj = [QQApiNewsObject
                                objectWithURL:[NSURL URLWithString:utf8String]
                                title:title
                                description:description
                                previewImageURL:[NSURL URLWithString:previewImageUrl]];
    SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
    
    //将内容分享到qzone
    QQApiSendResultCode sent = [QQApiInterface SendReqToQZone:req];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
